package com.test.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: 浪客
 * @Date: 2021-08-14 17:03
 * @Description: mvc拦截器配置类 调用前面Interceptor类
 */
@Configuration
public class MvcConfig implements WebMvcConfigurer {
    @Bean
    public Interceptor interceptor(){
        return new Interceptor();
    }
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor()).addPathPatterns("/**");
    }
}
